angular.module('starter.home.service', [])


.factory('$$HomeService', function($rootScope, $http, $$LocalStorage,$$SignService) {
    console.info("factory----------$$OnlineStudy");
    return {
        // 驾校加盟
        schoolAdd: function(schoolJoin) {
            // var data = {
            //     memberId: $rootScope.userData.id,
            //     phone: schoolJoin.schoolPhone,
            //     address: schoolJoin.schoolAddress,
            //     name: schoolJoin.schoolName,
            //     thumb: schoolJoin.schoolPic
            // };
            // console.log(data);
            // return $http.post($rootScope.config.apiHost + "api/v1/school/schoolApprove.api", data);
            var data = {
                apiUrl: "api/v1/school/schoolApprove.api",
                memberId: $rootScope.userData.id,
                phone: schoolJoin.schoolPhone,
                address: schoolJoin.schoolAddress,
                name: schoolJoin.schoolName,
                thumb: schoolJoin.schoolPic,
                token: $rootScope.userData.token,
            };
            return $http.post($rootScope.config.apiHost + data.apiUrl, $$SignService.sign(data));
        },
        //教练认证
        coachRz: function(coach) {
            // var data = {
            //     memberId: $rootScope.userData.id,
            //     name: coach.coachName,
            //     phone: coach.coachPhone,
            //     thumb: coach.coachPic,
            //     sex: coach.coachSex,
            //     school: coach.school
            // };
            // console.log(data);
            // return $http.post($rootScope.config.apiHost + "api/v1/school/coachApprove.api", data);
            var data = {
                apiUrl: "api/v1/school/coachApprove.api",
                memberId: $rootScope.userData.id,
                name: coach.coachName,
                phone: coach.coachPhone,
                thumb: coach.coachPic,
                sex: coach.coachSex,
                school: coach.school,
                token: $rootScope.userData.token,
            };
            return $http.post($rootScope.config.apiHost + data.apiUrl, $$SignService.sign(data));

        },
    };
})

;
